#!/bin/sh

HOSTNAME=`hostname -f`

ipropd_master_start() {
  if [ -x /usr/heimdal/libexec/ipropd-master ]; then
    echo "Starting the ipropd-master service: /usr/heimdal/libexec/ipropd-master --detach"
    /usr/heimdal/libexec/ipropd-master --detach --hostname=$HOSTNAME
  fi
}

ipropd_master_stop() {
  killall ipropd-master
}

ipropd_master_restart() {
  ipropd-master_stop
  sleep 1
  ipropd-master_start
}

case "$1" in
  'start')
    ipropd_master_start
  ;;
  'stop')
    ipropd_master_stop
  ;;
  'restart')
    ipropd_master_restart
  ;;
  *)
    echo "Usage: $0 start|stop|restart"
  ;;
esac

